<?php

header("Content-type:application/json;charset=utf-8");
$url = '10.68.2.31:9090/getStatus';//请求地址
$param = array('liftNum' => 'C003');//发送的数据
$date =json_encode($param);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);//为该对象设置选项，将“CURLOPT_POST”选项设置为true以指示服务器该请求是一个POST请求
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);//将数据包含在请求体中，并使用“http_build_query”函数将数据转换为URL编码的字符串
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    "Content-Type: application/json; charset=utf-8",
    "Content-Length: " . strlen($data_string))
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);//使cURL方法将响应输出到变量中而不是打印到页面上

$response = curl_exec($ch);//执行请求并在执行完毕后关闭请求
curl_close($ch);

if(!empty($response)) {
    $responseData = json_decode($response, true);
    if(!empty($responseData)) {
        echo '请求成功！返回的数据是：' . $responseData['message'];
    }
}

?>